package com.distributed.tcp.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.netty.channel.Channel;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.UUID;

@Data
public class DeviceConnection implements Serializable {
    @JsonIgnore  // 序列化时忽略该字段
    private transient Channel channel; // 不序列化，仅本地持有
    private String deviceCode;
    private int port;
    private String host;
    private String serverName;
    private LocalDateTime connectTime;

    public DeviceConnection(int port, String host,String deviceCode,String serverName) {
        this.port = port;
        this.host = host;
        this.deviceCode = deviceCode;
        this.serverName = serverName;
        this.connectTime = LocalDateTime.now();
    }
}
